(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 10.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] NotebookDataLength[ 3841, 114] NotebookOptionsPosition[ 3449, 95] NotebookOutlinePosition[ 3836, 112] CellTagsIndexPosition[ 3793, 109] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[BoxData[ RowBox[{"(*", " ", RowBox[{ "C\[AAcute]lculo", " ", "dos", " ", "d\[IAcute]gitos", " ", "em", " ", "base", " ", "b", " ", "de", " ", "um", " ", "n\[UAcute]mero", " ", "natural", " ", "x", " ", "dado", " ", "em", " ", "base", " ", "10."}], " ", "*)"}]], "Input", CellChangeTimes->{{3.759497868748352*^9, 3.759497973693116*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{" ", RowBox[{ RowBox[{ RowBox[{"b", "=", "3"}], ";"}], " ", "\[IndentingNewLine]", RowBox[{ RowBox[{"x", "=", "12345"}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"Frac", "[", "y_", "]"}], ":=", RowBox[{"y", "-", RowBox[{"Floor", "[", "y", "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"a", "=", RowBox[{"{", "}"}]}], ";"}], " ", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"While", "[", RowBox[{ RowBox[{"x", ">", "0"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"a", "=", RowBox[{"Append", "[", RowBox[{"a", ",", RowBox[{"b", " ", RowBox[{"Frac", "[", RowBox[{"x", "/", "b"}], "]"}]}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"x", "=", RowBox[{"Floor", "[", RowBox[{"x", "/", "b"}], "]"}]}]}]}], "\[IndentingNewLine]", "]"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"n", "=", RowBox[{"Length", "[", "a", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"Table", "[", RowBox[{ RowBox[{"a", "[", RowBox[{"[", RowBox[{"n", "-", "i", "+", "1"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}]}], "]"}], "\[IndentingNewLine]"}]}]], "Input", CellChangeTimes->{{3.75943595973897*^9, 3.75943597668908*^9}, { 3.759436008864225*^9, 3.759436024794539*^9}, {3.7594360677140417`*^9, 3.75943634753892*^9}, {3.75943643011622*^9, 3.759436488255475*^9}, { 3.759436529059752*^9, 3.759436538330093*^9}, {3.7594365723295383`*^9, 3.7594366023433228`*^9}, {3.7594366564794703`*^9, 3.759436663926947*^9}, { 3.759436766034067*^9, 3.7594367888491163`*^9}, 3.7594368256371717`*^9, { 3.759436868815421*^9, 3.759436907019972*^9}, 3.759436966275073*^9, { 3.7594370002728*^9, 3.7594371453764277`*^9}, {3.759437175414997*^9, 3.7594371876768837`*^9}, {3.7594375410671797`*^9, 3.759437666920676*^9}, { 3.759497829867242*^9, 3.759497864522004*^9}, {3.759497921848737*^9, 3.759497953095271*^9}, {3.7594979879262466`*^9, 3.759497988937489*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{ "1", ",", "2", ",", "1", ",", "2", ",", "2", ",", "1", ",", "0", ",", "2", ",", "0"}], "}"}]], "Output", CellChangeTimes->{{3.7594376338593807`*^9, 3.759437667998575*^9}, { 3.759497982450851*^9, 3.759497990019713*^9}}] }, Open ]] }, WindowSize->{808, 911}, WindowMargins->{{Automatic, 449}, {Automatic, 8}}, Magnification:>1.5 Inherited, FrontEndVersion->"10.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (December 4, \ 2014)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[558, 20, 359, 7, 69, "Input"], Cell[CellGroupData[{ Cell[942, 31, 2221, 53, 369, "Input"], Cell[3166, 86, 267, 6, 43, "Output"] }, Open ]] } ] *) (* End of internal cache information *)